package cn.codeforfun.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ui.velocity.VelocityEngineFactoryBean;

import java.util.Properties;

/**
 * Package cn.codeforfun.config
 * Project SpringBootMail
 * Author WangBin
 * Email bin.wang12@pactera.com
 * Created on 2017/6/9 17:01
 * version 1.0.0
 */
@Configuration
public class VelocityConfig {
  @Bean("velocityEngine")
  public VelocityEngineFactoryBean getVelocityEngineFactoryBean() {
    VelocityEngineFactoryBean velocityEngineFactoryBean = new VelocityEngineFactoryBean();
    Properties velocityProperties = new Properties();
    velocityProperties.setProperty("resource.loader", "class");
    velocityProperties.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
    velocityEngineFactoryBean.setVelocityProperties(velocityProperties);
    return velocityEngineFactoryBean;
  }
}
